package org.geektimes.common.util;

import cn.hutool.core.util.ArrayUtil;

import java.util.Arrays;
import java.util.List;

/**
 * @FileName: StringConvertUtil
 * @Description: 参数类型转换工具类
 * @Author: MaWenHao
 * @Created: 2021/3/1 - 下午9:10
 */
public final class StringConvertUtil {

    public static List<String> stringToListString(String[] strings) {
        return Arrays.asList(strings);
    }

    public static int stringToInt(String[] strings) {
        if (ArrayUtil.isEmpty(strings)) {
            return 0;
        }
        return Integer.parseInt(strings[0]);
    }
    public static long stringToLong(String[] strings) {
        if (ArrayUtil.isEmpty(strings)) {
            return 0L;
        }
        return Long.parseLong(strings[0]);
    }
    public static String stringToString(String[] strings) {
        if (ArrayUtil.isEmpty(strings)) {
            return null;
        }
        return strings[0];
    }

}
